<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
    <script src="lib/vue-router-3.0.1.js"></script>

</head>
<body>

<div id="app">
<com1 v-bind:parent="msg" @func="getMsgFormSon"></com1>
</div>
<template id="tmp1">
    <div>
        <h1>这是子元素--{{parent}}</h1>
        <input type="button" value="向fu组件传递消息" @click="sendmsg">
    </div>
</template>
<script>
  var com1={
    template:"#tmp1",
    props:["parent"],
    data(){
      return {
        msg:"孝顺的孩子，给爸爸钱"
      }
    },
    methods:{
      sendmsg(){
        this.$emit("func",this.msg)
      }
    }
  }
  var vm = new Vue({
    el: "#app",
    data: {
      msg:"爸爸有100元钱",
      msgFormSon:""
    },
    methods: {
      getMsgFormSon(data){
        this.msgFormSon=data
        console.log(this.msgFormSon)
      }
    },
    components:{
      com1:com1
    }
  })

</script>

</body>
</html>